package com.atguigu.springcloud;

import com.netflix.hystrix.contrib.metrics.eventstream.HystrixMetricsStreamServlet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @ClassName : com.atguigu.springcloud.PaymenthystrixMain8001
 * @Description : 类描述
 * Created by cyd on 2021-10-20 19:27:23
 */
@SpringBootApplication
@EnableEurekaClient
@EnableCircuitBreaker // 启动服务保护
public class PaymentHystrixMain8001 {

    private static ConfigurableApplicationContext context;

    public static void main(String[] args) {
        context = SpringApplication.run(PaymentHystrixMain8001.class, args);
        System.out.println("--------------项目启动了---------------");
        ConfigurableEnvironment environment = context.getEnvironment();
        String port = environment.getProperty("server.port");
        System.out.println("server.port" + port);
        System.out.println("http://localhost:" + port + "/payment/hystrix/ok/1");
        System.out.println("http://localhost:" + port + "/payment/hystrix/timeOut/1");
        System.out.println("http://localhost:" + port + "/payment/hystrix/paymentCircuitBreaker/1");

    }
}
